import {baseEffects, baseReducers, baseState} from "../../../../models/baseModel";
import PageHelper from "utils/pageHelper";
import moment from "moment";

export default {
  namespace: 'slist',

  state: {
    ...baseState,
    allAreas: [],
    loadAreas: false,
  },

  reducers: {
    ...baseReducers
  },

  effects: {

    ...baseEffects,

    // 进入页面加载
    * init({payload}, {put, call}) {

      yield put({type: 'loading'});

      const {notice, patientId} = payload;

      let result = [];
      for (var i = 0; i < 8; i++) {
        result.push({
          id: i,
          version: '1.'+i,
          upTime: moment().format("YYYY-MM-DD HH:mm:ss"),
          deviceCount: 10,
          lastVersion: "N",
        });
      }
      result[7].lastVersion = 'Y';

      result = result.reverse();

      yield put({
        type: 'list',
        payload: {
          data: PageHelper.wrapPage(result),
        }
      });
    },

  }

}

function getBaseUrl() {
  return "/mlnx_data/bp";
}

